<template>
  <div class="md-container">
    <div class="markdown-body">
      <slot>
        <article v-html="compiledMarkdown(content)"/>
      </slot>
    </div>
  </div>
</template>

<script>
  let marked = require('marked');

  marked.setOptions({
    renderer: new marked.Renderer(),
    gfm: true,
    tables: true,
    breaks: true,
    pedantic: false,
    sanitize: false,
    smartLists: true,
    smartypants: false
  });

  export default {
    name: 'MdStr',
    props: {
      content: {
        default: "",
        type: String
      }
    },
    methods: {
      compiledMarkdown(mdString) {
        return marked(mdString || '', {
          sanitize: false
        });
      }
    }
  }
</script>

<style lang="scss" scoped>
  .md-container {}
</style>

